<!--
 * @Date: 2019-11-25 10:17:48
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2020-05-07 14:42:55
 * @describe: -楼盘字典-
 -->
<template>
  <div class="BuildingDictionaries">
    <el-card shadow="never" class="aui-card--fill zidian_card_1">
      <el-row>
        <el-col :span="12">
          <div class="title">{{floorName}}</div>
        </el-col>
        <el-col :span="12" class="text_right">
          <el-button
            size="mini"
            @click="ZDsaveDialog = true"
            v-if="$hasPermission('dictionary:dictmajorzd:save')"
          >添加栋座</el-button>
        </el-col>
      </el-row>

      <div>
        <ul class="Dictionaries_t_ul clearfix">
          <li class="BuildingDictionaries_radio" v-for="(item,index) in buildingList" :key="index">
            <div class="Dictionaries_LD_img" @click="getLDinformation(item,$event)">
              <img src="~@/assets/img/楼栋.png" alt />
            </div>
            <div class="Dictionaries_LD_d">
              <div class="Dictionaries_LD_d_t">
                {{item.num+item.unit+'（'+(item.roomNum==null?'0':item.roomNum)+'户）'}}
                <span
                  class="TabHeader_icon"
                  @click="UpdateZD(item)"
                  v-if="MaintainType&&$hasPermission('dictionary:dictmajorzd:update')"
                  style="padding-top:1px"
                >
                  <svg class="icon-svg svgColor1" aria-hidden="true">
                    <use xlink:href="#edit" />
                  </svg>
                </span>

                <span
                  class="TabHeader_icon"
                  @click="deleteZD(item)"
                  v-if="MaintainType&&$hasPermission('dictionary:dictmajorzd:delete')"
                >
                  <svg class="icon-svg" aria-hidden="true">
                    <use xlink:href="#delete" />
                  </svg>
                </span>
              </div>
              <el-radio-group v-model="radio" class="Dictionaries_LD_d_b">
                <el-radio
                  :label="itm"
                  @click.native="DYclick($event,itm)"
                  v-for="(itm,ind) in item.dictMajorDY"
                  :key="ind"
                >{{itm.num+'单元'}}</el-radio>
              </el-radio-group>
              <span
                v-if="MaintainType&&$hasPermission('dictionary:dictmajordy:save')"
                style="padding-top:2px;"
                @click="DYsaveFrom.zdId=item.id;DYsaveDialog=true;"
              >
                <svg class="icon-svg icon" aria-hidden="true">
                  <use xlink:href="#add" />
                </svg>
              </span>
              <div class="Dictionaries_LD_d_t">
                <span class="float_l">维护人：{{item.realName}}</span>
                <span
                  class="TabHeader_icon"
          
                  v-if="MaintainType&&$hasPermission('dictionary:dictmajorzd:update')"
                  style="padding-top:1px"
                >
                  <svg class="icon-svg svgColor1" aria-hidden="true">
                    <use xlink:href="#edit" />
                  </svg>
                </span>
       

                 <!-- <el-popover placement="bottom" trigger="click">
                  <span class="TabHeader_icon" slot="reference">
                    <svg class="icon-svg icon" aria-hidden="true">
                      <use xlink:href="#edit" />
                    </svg>
                  </span>
                  <div>
                    部门：
                    <el-cascader
                      style="width:120px"
                      v-model="deptSelectVal"
                      :options="this.$store.state.DeptList"
                      :show-all-levels="false"
                      @change="deptIdChange"
                      :props="deptProps"
                      ref="myCascader"
                    ></el-cascader>
                  </div>
                  <div>
                    人员：
                    <el-select v-model="AddMaintainCheck.id" placeholder="请选择" style="width:120px">
                      <el-option
                        v-for="item in maintainList"
                        :key="item.id"
                        :label="item.realName"
                        :value="item.id"
                        @click.native="maintainChange(item)"
                      ></el-option>
                    </el-select>
                  </div>
                </el-popover> -->
              </div>
            </div>
          </li>
        </ul>
        <!-- <div
          style="margin-top:20px;"
          >
          <el-checkbox
              :indeterminate="isIndeterminate"
              v-model="checkAll"
              @change="handleCheckAllChange"
          >全选</el-checkbox>
          <el-checkbox-group
              v-model="checkedCities"
              class="Dictionaries_t_ul clearfix"
              @change="handleCheckedCitiesChange"
          >
              <el-checkbox
              v-for="(item,index) in buildingList"
              :label="item"
              :key="index"
              class="BuildingDictionaries_radio"
              >
              <div
                  class="Dictionaries_LD_img"
                  @click="getLDinformation(item)"
              >
                  <img
                  src="~@/assets/img/楼栋.png"
                  alt
                  />
              </div>
              <div class="Dictionaries_LD_d">
                  <div class="Dictionaries_LD_d_t">{{item.num+'栋'+'（'+(item.roomNum==null?'0':item.roomNum)+'户）'}}
                  <span
                      class="TabHeader_icon"
                      @click="UpdateZD(item)"
                  >
                  </span>
                  </div>
                  <el-radio-group
                  v-model="radio"
                  class="Dictionaries_LD_d_b"
                  >
                  <el-radio
                      :label="3"
                      @click.native="DYclick($event,itm)"
                      v-for="(itm,ind) in item.dictMajorDY"
                      :key="ind"
                  >{{itm.num+'单元'}}</el-radio>
                  </el-radio-group>
              </div>
              </el-checkbox>
          </el-checkbox-group>
        </div>-->
        <!-- <div class="colorGray martop10">
          <span class="float_l">栋座维护人：</span>
          <el-checkbox-group v-model="MaintainCheckList" class="float_l">
            <el-checkbox
              :label="item.id"
              v-for="(item,index) in WartungsmannList"
              :key="index"
            >{{item.sysSimpleUserDTO.realName}}</el-checkbox>
          </el-checkbox-group>

          <span class="TabHeader_icon" v-if="MaintainType" @click="deleteMaintain">
            <svg class="icon-svg" aria-hidden="true">
              <use xlink:href="#delete" />
            </svg>
          </span>

          <el-popover placement="bottom" trigger="click" v-if="MaintainType">
            <span class="TabHeader_icon" slot="reference">
              <svg class="icon-svg icon" aria-hidden="true">
                <use xlink:href="#add" />
              </svg>
            </span>
            <div>
              部门：
              <el-cascader
                style="width:120px"
                v-model="deptSelectVal"
                :options="this.$store.state.DeptList"
                :show-all-levels="false"
                @change="deptIdChange"
                :props="deptProps"
                ref="myCascader"
              ></el-cascader>
            </div>
            <div>
              人员：
              <el-select v-model="AddMaintainCheck.id" placeholder="请选择" style="width:120px">
                <el-option
                  v-for="item in maintainList"
                  :key="item.id"
                  :label="item.realName"
                  :value="item.id"
                  @click.native="maintainChange(item)"
                ></el-option>
              </el-select>
            </div>
          </el-popover>
        </div> -->

        <el-pagination
          :current-page="ZDpage"
          :page-size="ZDlimit"
          :total="ZDtotal"
          :pager-count="5"
          layout="total, prev, pager, next"
          @current-change="ZDCurrentChange"
          style="margin-top:0px"
        ></el-pagination>
      </div>
    </el-card>
    <span class="Arrow" :style="ArrowSty()"></span>
    <el-row>
      <el-col :span="18">
        <el-card shadow="never" class="aui-card--fill DictionariesCont">
          <el-row>
            <el-col :span="3" class="lih33">{{'楼栋信息'}}</el-col>

            <el-col :span="16">
              <span class="colorBoxMain lih33" v-for="(item,index) in roomState" :key="index">
                <span class="colorBox" :style="'background:'+item.color"></span>
                {{item.type}}
              </span>
              <!-- <div v-if="MaintainType&&$hasPermission('dictionary:dictmajorfj:mergeroom')"> -->
              <div v-if="$hasPermission('dictionary:dictmajorfj:mergeroom')">
                <el-button size="mini" @click="RoomVerschmelzen">合并房间</el-button>
                <el-button size="mini" @click="goRoomSplit">拆分房间</el-button>
                <!-- <el-button size="mini" @click="setRoomSplit">拆分房间</el-button> -->
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-table
                :data="tableData"
                stripe
                border
                style="width: 100%;"
                :max-height="tableHeight"
                class="roomTable"
                v-loading="loading"
                :header-cell-style="headerCellStyle"
                highlight-current-row
                @current-change="handleCurrentChange"
              >
                <el-table-column
                  prop="storeyCoordinate"
                  label="楼层"
                  width="120"
                  fixed
                  align="center"
                >
                  <template slot="header" slot-scope="scope">
                    楼层
                    <span class="svgIconStyle" v-if="MaintainType" @click="LCsaveDialog=true">
                      <svg class="icon-svg icon svgStyle" aria-hidden="true">
                        <use xlink:href="#add" />
                      </svg>
                    </span>
                    <!-- <span
                      class="TabHeader_icon"
                        @click="UpdateLC"
                        v-if="MaintainType"
                      >
                          <svg class="icon-svg svgColor1" aria-hidden="true"><use xlink:href="#edit"></use></svg>
                    </span>-->
                    <span class="svgIconStyle" @click="deleteLC" v-if="MaintainType">
                      <svg class="icon-svg svgStyle" aria-hidden="true">
                        <use xlink:href="#delete" />
                      </svg>
                    </span>
                  </template>
                  <template slot-scope="scope">{{scope.row.storeyCoordinate +'层'}}</template>
                </el-table-column>
                <el-table-column prop="dictMajorFJDTOS">
                  <template slot="header" slot-scope="dictMajorFJDTOS">
                    {{
                    tableTitleDY+'单元'
                    }}
                    <!-- <span
                          class="svgIconStyle"
                          v-if="MaintainType&&$hasPermission('dictionary:dictmajordy:update')"
                      >
                          <svg class="icon-svg svgColor1" aria-hidden="true"><use xlink:href="#edit"></use></svg>
                    </span>-->
                    <span
                      class="svgIconStyle"
                      @click="deleteDY"
                      v-if="MaintainType&&$hasPermission('dictionary:dictmajordy:delete')"
                    >
                      <svg class="icon-svg svgStyle" aria-hidden="true">
                        <use xlink:href="#delete" />
                      </svg>
                    </span>
                  </template>
                  <template slot-scope="scope">
                    <div
                      v-for="(item,index) in scope.row.dictMajorFJDTOS"
                      :key="item.id"
                      :style="roomStyle(item)"
                      class="roombox"
                    >
                      <div
                        :style="roomStyle2(item)"
                        class="roombox_t"
                        @click="roomInformation(item)"
                      >{{item.num}}</div>
                      <span class="election_man" @click="SelectedState(item)" v-if="MaintainType">
                        <span class="election_con" v-if="item.SelectedState"></span>
                      </span>
                      <span
                        class="svgIconStyle2"
                        @click="RoomUpdate(item)"
                        v-if="MaintainType&&$hasPermission('dictionary:dictmajorfj:update')"
                      >
                        <svg class="icon-svg svgColor1 svgStyle" aria-hidden="true">
                          <use xlink:href="#edit" />
                        </svg>
                      </span>
                    </div>
                    <el-button
                      type="text"
                      size="small"
                      @click="DeleteRoom(scope.row.dictMajorFJDTOS)"
                      style="margin-top:10px;"
                      v-if="MaintainType&&$hasPermission('dictionary:dictmajorfj:delete')"
                    >删除</el-button>
                  </template>
                </el-table-column>

                <el-table-column
                  fixed="right"
                  label="操作"
                  width="50"
                  v-if="MaintainType&&$hasPermission('dictionary:dictmajorfj:save')"
                >
                  <template slot-scope="scope">
                    <el-button type="text" size="small" @click="AddFJfun(scope.row)">添加</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
          </el-row>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card shadow="never" class="aui-card--fill DictionariesCont">
          <el-tabs v-model="Rrght_tabsName" v-if="LDtabs">
            <el-tab-pane label="基本信息" name="first">
              <ul class="Rrght_tabs_ul">
                <li>
                  <span>地上总层：</span>
                  {{LDinformationFrom.lowerLayer}}
                </li>
                <li>
                  <span>地下总层：</span>
                  {{LDinformationFrom.upperLayer}}
                </li>
                <li>
                  <span>平均户数：</span>
                  {{LDinformationFrom.house}}
                </li>
                <li>
                  <span>消防层：</span>
                  {{LDinformationFrom.fireControl }}
                </li>
                <li>
                  <span>建筑年代：</span>
                  {{LDinformationFrom.buildYear}}
                </li>
                <li>
                  <span>使用率：</span>
                  {{LDinformationFrom.utilizationRate}}
                </li>
                <li>
                  <span>建筑类型：</span>
                  {{$getDictLabel("dictType", LDinformationFrom.dictType)}}
                </li>
                <li>
                  <span>栋号：</span>
                  {{LDinformationFrom.num}}
                </li>
              </ul>
            </el-tab-pane>
          </el-tabs>

          <el-tabs v-model="Rrght_tabsName2" @tab-click="handleClick_FJ" v-else>
            <el-tab-pane label="基本信息" name="first">
              <el-tabs v-model="Rrght_tabsName2_tab" @tab-click="handleClick_FJ_tab">
                <el-tab-pane label="房间信息" name="first">
                  <ul class="Rrght_tabs_ul">
                    <li>
                      <span>房间号：</span>
                      {{roomFrom.num }}
                    </li>
                    <li>
                      <span>是否为合并房：</span>
                      {{roomFrom.merge==1?'是':'否' }}
                    </li>
                    <li>
                      <span>房间数：</span>
                      {{roomFrom.roomNum }}
                    </li>
                    <li>
                      <span>目前状态：</span>
                      {{$getDictLabel("dictSituation", roomFrom.state )}}
                    </li>
                    <li>
                      <span>面积：</span>
                      {{roomFrom.area}}
                    </li>
                    <li>
                      <span>出租单价：</span>
                      {{roomFrom.leasePrice }}
                    </li>
                    <li>
                      <span>出租总价：</span>
                      {{roomFrom.leasePrices }}
                    </li>
                    <li>
                      <span>出售单价：</span>
                      {{roomFrom.sellPrice }}
                    </li>
                    <li>
                      <span>出售总价：</span>
                      {{roomFrom.sellPrices }}
                    </li>
                    <li>
                      <span>装修情况：</span>
                      {{$getDictLabel("dictRenovation", roomFrom.renovation)}}
                    </li>
                    <li>
                      <span>房屋朝向：</span>
                      {{$getDictLabel("dictDirection", roomFrom.direction)}}
                    </li>
                    <li>
                      <span>产权证：</span>
                      {{roomFrom.titleDeed }}
                    </li>
                    <li>
                      <span>佣金：</span>
                      {{roomFrom.commission }}
                    </li>
                    <li>
                      <span>看房方式：</span>
                      {{$getDictLabel("dictLookMode", roomFrom.lookMode)}}
                    </li>
                    <li>
                      <span>配置：</span>
                      <small
                        v-for="(item,index) in roomFrom.conf!=null?roomFrom.conf.split(','):[]"
                      >{{$getDictLabel("dictConf", item)}},</small>
                    </li>
                  </ul>
                </el-tab-pane>

                <el-tab-pane label="业主信息" name="second">
                  <ul class="Rrght_tabs_ul">
                    <li>
                      <span>业主姓名：</span>
                      {{roomFrom.ownerName}}
                    </li>
                    <li>
                      <span>业主电话1：</span>
                      {{roomFrom.ownerPhone1}}
                    </li>
                    <li>
                      <span>业主电话2：</span>
                      {{roomFrom.ownerPhone2}}
                    </li>
                    <li>
                      <span>委托人姓名：</span>
                      {{roomFrom.ownerClientName}}
                    </li>
                    <li>
                      <span>委托人电话：</span>
                      {{roomFrom.ownerClientPhone}}
                    </li>
                    <li>
                      <span>业主公司名称：</span>
                      {{roomFrom.ownerCompanyName}}
                    </li>
                    <li>
                      <span>业主公司电话：</span>
                      {{roomFrom.ownerCompanyPhone}}
                    </li>
                    <li>
                      <span>包租名称：</span>
                      {{roomFrom.ownerLeaseName}}
                    </li>
                    <li>
                      <span>包租电话：</span>
                      {{roomFrom.ownerLeasePhone}}
                    </li>
                    <li>
                      <span>业主职业：</span>
                      {{roomFrom.ownerOccupation}}
                    </li>
                    <li>
                      <span>购房方式：</span>
                      {{$getDictLabel("dictOwnerBuy", roomFrom.ownerBuy)}}
                    </li>
                    <li>
                      <span>贷款金额：</span>
                      {{roomFrom.ownerBuyPrice}}
                    </li>
                    <li>
                      <span>贷款银行：</span>
                      {{roomFrom.ownerBuyBank}}
                    </li>
                    <li>
                      <span>是否有发票：</span>
                      {{roomFrom.ownerBuyBill}}
                    </li>
                  </ul>
                </el-tab-pane>
                <el-tab-pane label="租户跟进" name="third">
                  <ul class="Rrght_tabs_ul">
                    <li>
                      <span>租户姓名：</span>
                      {{roomFrom.tenantName}}
                    </li>
                    <li>
                      <span>租户电话：</span>
                      {{roomFrom.tenantPhone}}
                    </li>
                    <li>
                      <span>租户公司：</span>
                      {{roomFrom.tenantCompanyName}}
                    </li>
                    <li>
                      <span>租户行业：</span>
                      {{roomFrom.tenantOccupation}}
                    </li>
                    <li>
                      <span>租户委托人：</span>
                      {{roomFrom.tenanClientName}}
                    </li>
                    <li>
                      <span>租户委托人电话：</span>
                      {{roomFrom.tenanClientPhone}}
                    </li>
                    <li>
                      <span>租期：</span>
                      {{roomFrom.tenanTime}}
                    </li>
                    <li>
                      <span>租金：</span>
                      {{roomFrom.tenanPrice}}
                    </li>
                    <li>
                      <span>付款方式：</span>
                      {{$getDictLabel("dictTenanPay", roomFrom.tenanPay)}}
                    </li>
                    <li>
                      <span>免租期：</span>
                      {{roomFrom.tenanFreeTime}}
                    </li>
                    <li>
                      <span>合同年限：</span>
                      {{roomFrom.tenanContractTime}}
                    </li>
                  </ul>
                </el-tab-pane>
              </el-tabs>
            </el-tab-pane>

            <el-tab-pane label="图片信息" name="second">
              <div>
                <!-- <el-upload
                class="upload-demo"
                action="/dictionary/dictinfo/upload"
                multiple
                :limit="3"
                :on-exceed="handleExceed"
                :file-list="fileList"
                :before-upload="imgUploadBefore"
                style="width:80px;float:left;margin-right:10px"
                >
                <el-button
                    size="small"
                    type="primary"
                    v-if="MaintainType&&$hasPermission('dictionary:dictfjimage:upload')"
                >上传图片</el-button>
                </el-upload>-->

                <el-button
                  type="primary"
                  v-if="MaintainType&&$hasPermission('dictionary:dictfjimage:upload')"
                  @click="UploadImg"
                >上传图片</el-button>

                <el-button
                  type="primary"
                  size="small"
                  v-if="MaintainType&&$hasPermission('dictionary:dictfjimage:delete')"
                  @click="DeleteRoomImg"
                >删除图片</el-button>
              </div>
              <div class="roomImg_main">
                <ul>
                  <li v-for="(item,index) in FJimgList" @click="SelectedState(item)">
                    <span class="election_man" v-if="MaintainType">
                      <span class="election_con" v-if="item.SelectedState"></span>
                    </span>
                    <div class="roomImg_box">
                      <img :src="item.url" alt />
                    </div>
                    <span class="colorGray display_i_b" style="padding-top:5px">{{item.title}}</span>
                    <!-- <span style="margin-left:10px;">
                                                
                    </span>-->
                  </li>
                </ul>
              </div>
              <el-pagination
                :current-page="FJimgPage"
                :page-size="FJimglimit"
                :total="FJimgtotal"
                :pager-count="5"
                layout="total, prev, pager, next"
                @current-change="FJimgCurrentChange"
              ></el-pagination>
            </el-tab-pane>
            <el-tab-pane label="状态跟进" name="third" class="text_center">
              <!-- <el-button
                    type="primary"
                    class="genjing_btn"
                    size="medium"
                >出售</el-button>
                <el-button
                    type="primary"
                    class="genjing_btn"
                    size="medium"
              >出租</el-button>-->
              <el-button type="primary" class="genjing_btn" size="medium">写跟进</el-button>
              <el-button type="primary" class="genjing_btn" size="medium">跟进记录</el-button>
              <!-- <el-button
                    type="primary"
                    class="genjing_btn"
                    size="medium"
                >写提醒</el-button>
                <el-button
                    type="primary"
                    class="genjing_btn"
                    size="medium"
              >提醒记录</el-button>-->
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>

    <RoomAddOrUpdate v-if="addOrUpdateVisible" ref="addOrUpdate"></RoomAddOrUpdate>

    <ZDaddOrUpdate
      v-if="ZDaddOrUpdateVisible"
      ref="ZDaddOrUpdate"
      :floorName="floorName"
      @refreshDataList="getLDinformation(buildingList[0])"
    ></ZDaddOrUpdate>

    <el-dialog title="批量添加座栋" :visible.sync="ZDsaveDialog" width="30%">
      <el-form ref="form" :model="ZDsaveFrom" label-width="100px" class="customFrom">
        <el-form-item label="座栋名">
          <el-input v-model="ZDsaveFrom.num"></el-input>
        </el-form-item>
        <el-form-item label="座栋数">
          <el-input v-model="ZDsaveFrom.zdNum"></el-input>
        </el-form-item>
        <el-form-item label="座栋数单位">
          <el-input v-model="ZDsaveFrom.unit"></el-input>
        </el-form-item>
        <el-form-item label="每栋单元数">
          <el-input v-model="ZDsaveFrom.dyNum"></el-input>
        </el-form-item>
        <el-form-item label="每单元楼层数">
          <el-input v-model="ZDsaveFrom.lcNum"></el-input>
        </el-form-item>
        <el-form-item label="每楼层房间数">
          <el-input v-model="ZDsaveFrom.fjNum"></el-input>
        </el-form-item>
        <el-form-item label="房号排序">
          <el-radio-group v-model="ZDsaveFrom.fjSort">
            <el-radio label="1">楼层+房间数字编号(如:101)</el-radio>
            <el-radio label="2">楼层+房间字母编号(如:1A)</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="起始编号">
          <el-input v-model="ZDsaveFrom.startNum"></el-input>
        </el-form-item>
        <el-form-item label="维护人部门">
          <el-cascader
            style="width:100%"
            v-model="deptSelectVal"
            :options="this.$store.state.DeptList"
            :show-all-levels="false"
            @change="deptIdChange"
            :props="deptProps"
            ref="myCascader"
          ></el-cascader>
        </el-form-item>
        <el-form-item label="维护人">
          <el-select
            v-model="ZDsaveFrom.maintain"
            placeholder="请选择"
            style="width:100%"
            :disabled="ZDsaveFrom.deptId==''"
          >
            <el-option
              v-for="item in ZDMaintainList"
              :key="item.id"
              :label="item.realName"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <template slot="footer">
        <el-button @click="Agentvisible = false">{{ $t('cancel') }}</el-button>
        <el-button type="primary" @click="AddZD">{{ $t('confirm') }}</el-button>
      </template>
      <!-- <span slot="footer" class="dialog-footer">
        <el-button @click="ZDsaveDialog = false">取 消</el-button>
        <el-button
          type="primary"
          @click="AddZD"
          v-if="$hasPermission('dictionary:dictmajorzd:save')"
          :loading="BtnLoading"
        >确 定</el-button>
      </span>-->
    </el-dialog>

    <el-dialog title="批量添加单元" :visible.sync="DYsaveDialog" width="30%">
      <el-form ref="form" :model="DYsaveFrom" label-width="100px" class="customFrom">
        <el-form-item label="单元数">
          <el-input v-model="DYsaveFrom.dyNum"></el-input>
        </el-form-item>
        <el-form-item label="每单元楼层数">
          <el-input v-model="DYsaveFrom.lcNum"></el-input>
        </el-form-item>
        <el-form-item label="每楼层房间数">
          <el-input v-model="DYsaveFrom.fjNum"></el-input>
        </el-form-item>
        <el-form-item label="房号排序">
          <el-radio-group v-model="DYsaveFrom.fjSort">
            <el-radio label="1">楼层+房间数字编号(如:101)</el-radio>
            <el-radio label="2">楼层+房间字母编号(如:1A)</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="起始编号">
          <el-input v-model="DYsaveFrom.startNum"></el-input>
        </el-form-item>
      </el-form>
      <template slot="footer">
        <el-button @click="Agentvisible = false">{{ $t('cancel') }}</el-button>
        <el-button type="primary" @click="AddDY()">{{ $t('confirm') }}</el-button>
      </template>
    </el-dialog>

    <el-dialog title="批量添加楼层" :visible.sync="LCsaveDialog" width="30%">
      <el-form ref="form" :model="LCsaveFrom" label-width="100px" class="customFrom">
        <el-form-item label="楼层数">
          <el-input v-model="LCsaveFrom.lcNum"></el-input>
        </el-form-item>
        <el-form-item label="每楼层房间数">
          <el-input v-model="LCsaveFrom.fjNum"></el-input>
        </el-form-item>
        <el-form-item label="房号排序">
          <el-radio-group v-model="LCsaveFrom.fjSort">
            <el-radio label="1">楼层+房间数字编号(如:101)</el-radio>
            <el-radio label="2">楼层+房间字母编号(如:1A)</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="起始编号">
          <el-input v-model="LCsaveFrom.startNum"></el-input>
        </el-form-item>
      </el-form>
      <template slot="footer">
        <el-button @click="Agentvisible = false">{{ $t('cancel') }}</el-button>
        <el-button type="primary" @click="AddLc()">{{ $t('confirm') }}</el-button>
      </template>
      <!-- <span slot="footer" class="dialog-footer">
        <el-button @click="LCsaveDialog = false">取 消</el-button>
        <el-button type="primary" @click="AddLc" v-if="MaintainType" :loading="BtnLoading">确 定</el-button>
      </span>-->
    </el-dialog>

    <el-dialog title="批量添加房间" :visible.sync="FJsaveDialog" width="30%">
      <el-form ref="form" :model="FJsaveFrom" label-width="100px" class="customFrom">
        <el-form-item label="每楼层房间数">
          <el-input v-model="FJsaveFrom.fjNum"></el-input>
        </el-form-item>
        <el-form-item label="房号排序">
          <el-radio-group v-model="FJsaveFrom.fjSort">
            <el-radio label="1">楼层+房间数字编号(如:101)</el-radio>
            <el-radio label="2">楼层+房间字母编号(如:1A)</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="起始编号">
          <el-input v-model="FJsaveFrom.startNum"></el-input>
        </el-form-item>
      </el-form>
      <template slot="footer">
        <el-button @click="Agentvisible = false">{{ $t('cancel') }}</el-button>
        <el-button type="primary" @click="AddFJ()">{{ $t('confirm') }}</el-button>
      </template>
      <!-- <span slot="footer" class="dialog-footer">
        <el-button @click="FJsaveDialog = false">取 消</el-button>
        <el-button
          type="primary"
          @click="AddFJ"
          v-if="MaintainType&&$hasPermission('dictionary:dictmajorfj:save')"
          :loading="BtnLoading"
        >确 定</el-button>
      </span>-->
    </el-dialog>

    <el-dialog title="上传房间图片" :visible.sync="FJdialogVisible" width="30%">
      <el-form ref="form" :model="FJimgUploadFrom" label-width="50px" label-position="top">
        <el-form-item label="备注">
          <el-input v-model="FJimgUploadFrom.title"></el-input>
        </el-form-item>
        <el-form-item label="选择图片">
          <el-upload
            class="upload-demo"
            ref="FJupload"
            action="/project/projectinfo/apartmentUpload"
            :file-list="fileListFJ"
            :auto-upload="false"
            :limit="1"
            list-type="picture-card"
          >
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="FJdialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="FJuploadFun" :loading="BtnLoading">点击上传</el-button>
      </span>
    </el-dialog>
    <!-- 拆分房间 -->
    <el-dialog :visible.sync="SplitRoomVisible" title="拆分房间" :destroy-on-close="true" width="30%">
      <el-form
        :model="SplitRoomFrom"
        ref="AgentForm"
        :label-width="$i18n.locale === 'en-US' ? '120px' : '100px'"
        class="svgColor4"
      >
        <el-form-item label="拆分间数">
          <el-input v-model="SplitRoomFrom.num"></el-input>
        </el-form-item>
      </el-form>

      <template slot="footer">
        <el-button @click="SplitRoomVisible = false">{{ $t('cancel') }}</el-button>
        <el-button type="primary" @click="roomSplit()">{{ $t('confirm') }}</el-button>
      </template>
    </el-dialog>
  </div>
</template>
<script>
import mixinViewModule from "@/mixins/view-module";
import RoomAddOrUpdate from "./dictmajorfj-add-or-update";
import ZDaddOrUpdate from "./dictmajorzd-add-or-update";
export default {
  name: "BuildingDictionaries",
  mixins: [mixinViewModule],
  data() {
    return {
      MaintainType: false,
      floorID: this.$route.query.ID,
      floorName: this.$route.query.name,
      getDYFJListID: "", //单元ID
      LDid: "", //座栋ID
      RoomID: "", //房间ID
      buildingList: [],
      roomFrom: {},
      radio: 3,
      ArrowStyLeft: 100,
      tableHeight: 500,
      roomState: [
        {
          color: "#F45C23",
          type: "出售",
          dictValue: "1",
        },
        {
          color: "#199696",
          type: "出租",
          dictValue: "2",
        },

        {
          color: "#A4D246",
          type: "租售",
          dictValue: "3",
        },
        {
          color: "#588EBB",
          type: "自住",
          dictValue: "4",
        },
        {
          color: "#F79116",
          type: "已租",
          dictValue: "5",
        },
        {
          color: "#e6e6e6",
          type: "状态未知",
          dictValue: "0",
        },
      ],
      tableData: [],
      tableTitleDY: "",
      ZDpage: 1,
      ZDlimit: 6,
      ZDtotal: 0,
      loading: true,
      BtnLoading: false,
      checkAll: false,
      SplitRoomVisible: false,
      checkedCities: [],
      cities: [],
      isIndeterminate: false,
      Rrght_tabsName: "first",
      LDinformationFrom: {},
      LDtabs: true,
      Rrght_tabsName2: "first",
      Rrght_tabsName2_tab: "first",
      FJimgPage: 1,
      FJimglimit: 10,
      FJimgtotal: 0,
      FJimgList: [],
      WartungsmannList: [],
      mixinViewModuleOptions: {
        createdIsNeed: false,
      },
      ZDaddOrUpdateVisible: false, //添加修改座栋弹窗
      fileList: [],
      LCid: "", //选中楼层号
      ZDsaveDialog: false, //添加座栋模态框
      ZDsaveFrom: {
        dictId: this.$route.query.ID, //楼盘id ,
        dyNum: "", //每栋单元数
        fjNum: "", // 每楼层房间数 ,
        fjSort: "1", //房号排序 ,
        lcNum: "", //每单元楼层数 ,
        startNum: "", //起始编号
        unit: "栋", //座栋数单位 ,
        zdNum: "", // 座栋数
        maintain: "", // 维护人
        deptId: "",
        num: "",
      },
      DYsaveDialog: false, //批量添加单元
      DYsaveFrom: {
        dictId: this.$route.query.ID,
        dyNum: "",
        fjNum: "",
        fjSort: "1",
        lcNum: "",
        startNum: "",
        zdId: "",
      },
      LCsaveDialog: false, //批量添加楼层
      LCsaveFrom: {
        dictId: this.$route.query.ID,
        dyId: "",
        fjNum: "",
        fjSort: "1",
        lcNum: "",
        startNum: "",
        zdId: "",
      },
      FJsaveDialog: false,
      FJsaveFrom: {
        dictId: this.$route.query.ID,
        dyId: "",
        fjNum: "",
        fjSort: "1",
        lcNum: "",
        startNum: "",
        zdId: "",
      },
      SplitRoomFrom: {
        num: "",
        id: "",
      },
      MaintainCheckList: [], //维护人选择列表
      AddMaintainCheck: {
        id: "",
        deptId: "",
        maintainName: "",
      }, //添加维护人选择列表\
      FJdialogVisible: false,
      FJimgUploadFrom: {
        title: "",
      },
      fileListFJ: [],
      maintainList: this.$store.state.maintainList,
      deptProps: {
        value: "id",
        label: "name",
        checkStrictly: true,
      },
      deptSelectVal: "",
      ZDMaintainList: [],
      ZDMaintainVisible: false,
    };
  },
  components: {
    RoomAddOrUpdate,
    ZDaddOrUpdate,
  },
  created() {
    this.tableHeight = this.SetTableHeight(425);
    this.getDictmajorzdList();
  },
  mounted() {},
  methods: {
    //获取栋座列表
    getDictmajorzdList() {
      let _this = this;
      this.$http
        .get(`/dictionary/dictmajorzd/list`, {
          params: {
            page: _this.ZDpage,
            limit: _this.ZDlimit,
            dictId: _this.floorID,
          },
        })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.buildingList = res.data.list;
          _this.ZDtotal = res.data.total;
          if (this.buildingList.length != 0) {
            _this.getMaintain(this.buildingList[0].id); //获取维护人列表
            _this.getLDinformation(this.buildingList[0]); //获取楼栋基本信息
          } else {
            _this.WartungsmannList = [];
            _this.MaintainCheckList = [];
            _this.LDinformationFrom = {};
            _this.tableData = [];
          }
        })
        .catch(() => {});
    },
    //部门change
    deptIdChange(val) {
      let a = "";
      if (this.$refs.myCascader.getCheckedNodes()[0]) {
        a = this.$refs.myCascader.getCheckedNodes()[0].value;
        this.ZDsaveFrom.deptId = a;
        this.getUserList(a);
      } else {
        this.ZDsaveFrom.deptId = "";
      }
    },
    // 获取部门员工列表
    getUserList(deptId) {
      let _this = this;
      this.$http
        .get(`/sys/user/deptValidUserList`, {
          params: {
            deptId: deptId,
          },
        })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.ZDMaintainList = res.data;
        })
        .catch(() => {});
    },
    //座栋分页
    ZDCurrentChange(num) {
      this.ZDpage = num;
      this.getDictmajorzdList();
    },

    ArrowSty() {
      return {
        left: this.ArrowStyLeft + "px",
      };
    },
    headerCellStyle() {
      return {
        textAlign: "center",
      };
    },

    //房间宽度
    roomStyle(item) {
      let w = 65;
      // if (item.merge == true) {
      w = item.roomNum * 65 + (item.roomNum - 1) * 20;
      // }
      return {
        width: w + "px",
      };
    },

    //房间内块状态
    roomStyle2(item) {
      let cor = "";
      const val = this.roomState.find(
        (element) => element.dictValue == item.state
      );
      if (val) {
        cor = val.color;
      }
      return {
        backgroundColor: cor,
      };
    },

    //修改房间和房间图片选中状态
    SelectedState(item) {
      let _this = this;
      if (item.SelectedState == false) {
        item.SelectedState = true;
        // _this.$set(_this.tableData[index].dictMajorFJDTOS[ind], "SelectedState", true);
        // _this.tableData[index].dictMajorFJDTOS.splice(ind, item.SelectedState, true)
        // arr.splice(ind, item.SelectedState, true)
        // _this.tableData[index].dictMajorFJDTOS[ind].$set("SelectedState", true)
        // _this.tableData[index].dictMajorFJDTOS[ind].SelectedState= true
        // _this.tableData[index].dictMajorFJDTOS[ind] = _.merge({},_this.tableData[index].dictMajorFJDTOS[ind],{SelectedState:true})
      } else {
        item.SelectedState = false;
        // _this.$set(_this.tableData[index].dictMajorFJDTOS[ind], "SelectedState", false);
        // _this.tableData[index].dictMajorFJDTOS.splice(ind, item.SelectedState, false)
        // arr.splice(ind, item.SelectedState, false)
        // _this.tableData[index].dictMajorFJDTOS[ind].$set("SelectedState", false)
        // _this.tableData[index].dictMajorFJDTOS[ind].SelectedState= false
        // _this.tableData[index].dictMajorFJDTOS[ind] = _.merge({},_this.tableData[index].dictMajorFJDTOS[ind],{SelectedState:false})
      }
    },

    //单元点击切换
    DYclick(eve, itm) {
      let _this = this;
      this.LDid = itm.zdId;
      let l = eve.target.getBoundingClientRect().left;
      if (l > 0) {
        this.ArrowStyLeft = l - 240;
        _this.getDYFJListID = itm.id;
        _this.tableTitleDY = itm.num;
        _this.getDYFJList();
      }
    },
    //获取维护人列表
    getMaintain(idNum) {
      let _this = this;
      this.$http
        .get(`/dictionary/dictmajorzd/getMaintain/`, {
          params: {
            idNum: idNum,
          },
        })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.WartungsmannList = res.data;
          _this.MaintainCheckList = [];
        })
        .catch(() => {});
    },

    //获取单元房间列表
    getDYFJList() {
      let _this = this;
      _this.loading = true;
      this.$http
        .get(`/dictionary/dictmajorfj/fjList`, {
          params: {
            id: _this.getDYFJListID,
          },
        })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.tableData = res.data;
          for (let i = 0; i < _this.tableData.length; i++) {
            let tiem = _this.tableData[i].dictMajorFJDTOS;
            for (let s = 0; s < tiem.length; s++) {
              _this.$set(tiem[s], "SelectedState", false);
            }
          }
          _this.loading = false;
        })
        .catch(() => {});
    },

    //楼栋全选状态
    handleCheckAllChange(val) {
      this.checkedCities = val ? this.buildingList : [];
      this.isIndeterminate = false;
    },
    handleCheckedCitiesChange(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.cities.length;
      this.isIndeterminate =
        checkedCount > 0 && checkedCount < this.cities.length;
    },

    //右侧tabs基本信息-图片信息-状态
    handleClick_FJ(tab, event) {},

    //右侧tabs房间信息下房间信息切换
    handleClick_FJ_tab(tab, event) {},

    //获取楼栋基本信息
    getLDinformation(item, eve) {
      let _this = this;
      this.LDid = item.id;
      this.$http
        .get(`/dictionary/dictmajorzd/${item.id}`)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.LDinformationFrom = res.data;
          _this.MaintainType = res.data.permission;
        })
        .catch(() => {});
      _this.getDYFJListID = item.dictMajorDY[0].id;
      _this.tableTitleDY = item.dictMajorDY[0].num;
      _this.getDYFJList(); //获取单元房间列表
      _this.getMaintain(_this.LDid); //获取维护人列表
      _this.LDtabs = true;

      let l = eve.target.getBoundingClientRect().left;
      if (l > 0) {
        this.ArrowStyLeft = l - 220;
      }
    },

    //获取房间基本信息
    roomInformation(item) {
      let _this = this;
      _this.LDtabs = false;
      _this.RoomID = item.id;
      this.$http
        .get(`/dictionary/dictmajorfj/${_this.RoomID}`)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.roomFrom = res.data;
        })
        .catch(() => {});
      _this.GetroomImg();
    },

    //获取房间图片信息
    GetroomImg() {
      let _this = this;
      this.$http
        .get(`/dictionary/dictmajorfj/imagePage`, {
          params: {
            page: _this.FJimgPage,
            limit: _this.FJimglimit,
            fjId: _this.RoomID,
          },
        })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.FJimgList = res.data.list;
          _this.FJimgtotal = res.data.total;
          for (let i = 0; i < _this.FJimgList.length; i++) {
            let item = _this.FJimgList[i];
            _this.$set(item, "SelectedState", false);
          }
        })
        .catch(() => {});
    },
    //房间图片信息翻页
    FJimgCurrentChange(num) {
      let _this = this;
      this.FJimgPage = num;
      this.GetroomImg();
    },
    //合并房间
    RoomVerschmelzen() {
      let _this = this;
      let arr = _this.getRoomSelect();
      if (arr.length > 0) {
        this.$http
          .get(`/dictionary/dictmajorfj/mergeRoom`, {
            params: {
              ids: arr.join(),
            },
          })
          .then(({ data: res }) => {
            if (res.code !== 0) {
              return this.$message.error(res.msg);
            }
            this.$message.success("合并成功");
            _this.getDYFJList();
          })
          .catch(() => {});
      } else {
        this.$message.error("请选择要合并的房间！");
      }
    },

    //拆分房间
    setRoomSplit() {
      let _this = this;
      let arr = _this.getRoomSelect("Split");
      // if (arr.length != 1) {
      //     this.$message.error("请选择一间已经合并房间！不可多选");
      // } else {
      this.$http
        .get(`/dictionary/dictmajorfj/splitRoom`, {
          params: {
            id: arr[0],
          },
        })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.getDYFJList();
        })
        .catch(() => {});
      // }
    },
    goRoomSplit() {
      let _this = this;
      let arr = _this.getRoomSelect("Split");
      if (arr.length != 1) {
        this.$message.error("请选择一间房间！不可多选");
      } else {
        this.SplitRoomFrom.num = "";
        this.SplitRoomFrom.id = arr[0];
        this.SplitRoomVisible = true;
      }
    },
    //拆分房间
    roomSplit() {
      let _this = this;
      this.$http
        .get(`/dictionary/dictmajorfj/splitRoom`, {
          params: {
            id: _this.SplitRoomFrom.id,
            num: _this.SplitRoomFrom.num,
          },
        })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          this.$message.success("拆分成功");
          _this.SplitRoomVisible = false;
          _this.getDYFJList();
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "拆分失败",
          });
        });
    },
    //获取选中的房间列表val
    getRoomSelect(val) {
      let arr = [];
      for (let i = 0; i < this.tableData.length; i++) {
        const element = this.tableData[i].dictMajorFJDTOS;
        for (let j = 0; j < element.length; j++) {
          const item = element[j];
          if (item.SelectedState == true) {
            arr.push(item.id);
            // if (val == "Split") {
            //     if (item.merge != 1) {
            //         return [];
            //     }
            // }
          }
        }
      }
      return arr;
    },

    //房间修改按钮
    RoomUpdate(item) {
      let _this = this;
      _this.addOrUpdateHandle(item.id);
    },

    //添加座栋
    AddZD() {
      let _this = this;
      _this.BtnLoading = true;
      this.$http
        .post(`/dictionary/dictmajorzd/saveList`, _this.ZDsaveFrom)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.getDictmajorzdList();
          _this.ZDsaveDialog = false;
          _this.$message.success("添加成功");
          _this.BtnLoading = false;
        })
        .catch(() => {});
    },

    //修改座栋
    UpdateZD(item) {
      this.ZDaddOrUpdateVisible = true;
      this.$nextTick(() => {
        this.$refs.ZDaddOrUpdate.dataForm.id = item.id;
        this.$refs.ZDaddOrUpdate.init();
      });
    },

    //删除座栋
    deleteZD(item) {
      let _this = this;
      this.$confirm("此操作将永久删除该座栋, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          _this.$http
            .delete(`/dictionary/dictmajorzd/${item.id}`)
            .then(({ data: res }) => {
              if (res.code !== 0) {
                return _this.$message.error(res.msg);
              }
              _this.$message.success("删除成功");
              this.getDictmajorzdList();
            })
            .catch(() => {});
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },

    //添加单元
    AddDY() {
      let _this = this;
      _this.BtnLoading = true;
      this.$http
        .post(`/dictionary/dictmajordy/saveUnitList`, this.DYsaveFrom)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.getDictmajorzdList();
          _this.DYsaveDialog = false;
          _this.$message.success("添加成功");
          _this.BtnLoading = false;
        })
        .catch(() => {});
    },

    //删除单元
    deleteDY() {
      let _this = this;
      this.$confirm("此操作将永久删除该单元, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          _this.$http
            .delete(`/dictionary/dictmajordy/${_this.getDYFJListID}`)
            .then(({ data: res }) => {
              if (res.code !== 0) {
                return _this.$message.error(res.msg);
              }
              _this.$message.success("删除成功");
              _this.getDictmajorzdList();
            })
            .catch(() => {});
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },

    //删除房间
    DeleteRoom(list) {
      // let roomId = list[list.length - 1].id;
      let arr = this.getRoomSelect();
      let _this = this;
      this.$confirm("此操作将永久删除选中的房间, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          _this.$http
            .post(
              `/dictionary/dictmajorfj/deleteFj`,
              {},
              {
                params: {
                  ids: arr.join(),
                },
              }
            )
            .then(({ data: res }) => {
              if (res.code !== 0) {
                return _this.$message.error(res.msg);
              }
              _this.$message.success("删除成功");
              _this.getDYFJList();
            })
            .catch(() => {});
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },

    //点击添加房间
    AddFJfun(row) {
      this.FJsaveFrom.dyId = this.getDYFJListID;
      this.FJsaveFrom.zdId = this.LDid;
      this.FJsaveFrom.lcNum = row.storeyCoordinate;
      this.FJsaveDialog = true;
    },

    //确定添加房间
    AddFJ() {
      let _this = this;
      _this.BtnLoading = true;
      this.$http
        .post(`/dictionary/dictmajorfj/saveList`, this.FJsaveFrom)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            _this.FJsaveDialog = false;
            return this.$message.error(res.msg);
          }
          _this.getDYFJList();
          _this.FJsaveDialog = false;
          _this.$message.success("添加成功");
          _this.BtnLoading = false;
        })
        .catch(() => {});
    },

    //上传房间图片限制
    handleExceed(files, fileList) {
      this.$message.warning(
        `当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${
          files.length + fileList.length
        } 个文件`
      );
    },

    // //上传房间图片
    // imgUploadBefore(file) {
    //   let _this = this;
    //   let formData = new FormData();
    //   formData.append("file", file);
    //   let params = formData;
    //   this.$http
    //     .post("/dictionary/dictmajorfj/upload", formData, {
    //       params: {
    //         fjId: _this.RoomID
    //       }
    //     })
    //     .then(({ data: res }) => {
    //       if (res.code !== 0) {
    //         return this.$message.error(res.msg);
    //       }
    //       this.$message.success("上传成功！");
    //       _this.GetroomImg();
    //     })
    //     .catch(() => {});
    //   return false;
    // },

    //获取房间图片选中的列表
    getRoomImgStlect() {
      let _this = this;
      let arr = [];
      for (let i = 0; i < _this.FJimgList.length; i++) {
        let item = _this.FJimgList[i];
        if (item.SelectedState == true) {
          arr.push(item.id);
        }
      }
      return arr;
    },

    //删除选中的房间图片
    DeleteRoomImg() {
      let _this = this;
      let arr = _this.getRoomImgStlect();
      if (arr.length > 0) {
        this.$confirm("您将删除该房间选中的图片, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          this.$http
            .post(
              `/dictionary/dictmajorfj/deleteImage`,
              {},
              {
                params: {
                  ids: arr.join(),
                },
              }
            )
            .then(({ data: res }) => {
              if (res.code !== 0) {
                return this.$message.error(res.msg);
              }
              this.$message.success("删除成功");
              _this.GetroomImg();
            })
            .catch(() => {});
        });
      } else {
        this.$message.error("请选择要删除的房间图片！");
      }
    },

    //修改楼层-选中行
    UpdateLC() {
      let _this = this;
    },

    //删除楼层-选中行
    deleteLC() {
      let _this = this;
      if (this.LCid != "") {
        this.$confirm(
          "您将删除该单元第 " + _this.LCid + " 层, 是否继续?",
          "提示",
          {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }
        )
          .then(() => {
            this.$http
              .get(`/dictionary/dictmajorfj/deleteFloor`, {
                params: {
                  dyId: _this.getDYFJListID,
                  storeyCoordinate: _this.LCid,
                },
              })
              .then(({ data: res }) => {
                if (res.code !== 0) {
                  return this.$message.error(res.msg);
                }
                this.$message.success("删除成功");
                _this.getDYFJList();
              })
              .catch(() => {});
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除",
            });
          });
      } else {
        this.$message({
          type: "info",
          message: "请选择要删除的楼层！",
        });
      }
    },

    //添加楼层
    AddLc() {
      let _this = this;
      _this.BtnLoading = true;
      this.LCsaveFrom.dyId = this.getDYFJListID;
      this.LCsaveFrom.zdId = this.LDid;
      this.$http
        .post(`/dictionary/dictmajorfj/saveFloorList`, this.LCsaveFrom)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.getDYFJList();
          _this.LCsaveDialog = false;
          _this.$message.success("添加成功");
          _this.BtnLoading = false;
        })
        .catch(() => {});
    },

    //房间表格选中列
    handleCurrentChange(val) {
      // this.LCid = val.storeyCoordinate;
    },

    //删除座栋维护人
    deleteMaintain() {
      let _this = this;
      if (this.MaintainCheckList.length > 0) {
        this.$confirm("您将删除该维护人, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          this.$http
            .post(
              `/dictionary/dictmajorzd/deleteMaintain`,
              {},
              {
                params: {
                  ids: this.MaintainCheckList.join(),
                  zdNum: _this.LDid,
                },
              }
            )
            .then(({ data: res }) => {
              if (res.code !== 0) {
                return this.$message.error(res.msg);
              }
              _this.getMaintain(_this.LDid); //获取维护人列表
            })
            .catch(() => {});
        });
      } else {
        this.$message.error("请选择要删除的维护人！");
      }
    },

    //添加座栋维护人
    addZDmaintain() {
      //     let _this = this;
      //     let obj = {
      //         numId: _this.LDid,
      //         maintain: this.AddMaintainCheck.id,
      //         deptId: this.AddMaintainCheck.deptId
      //     };
      //     if (obj.maintain) {
      //         this.$http
      //             .post(`/dictionary/dictmajorzd/savemaintain`, obj)
      //             .then(({ data: res }) => {
      //                 if (res.code !== 0) {
      //                     return this.$message.error(res.msg);
      //                 }
      //                 _this.getMaintain(_this.LDid); //获取维护人列表
      //             })
      //             .catch(() => {});
      //     } else {
      //         this.$message.error("请选择要添加的维护人！");
      //     }
    },
    //点击上传房间图片
    UploadImg() {
      this.fileListFJ = [];
      this.FJimgUploadFrom.title = "";
      this.FJdialogVisible = true;
    },
    //确定上传房间图片
    FJuploadFun() {
      let _this = this;
      _this.BtnLoading = true;
      let formData = new FormData();
      formData.append("file", this.$refs.FJupload.uploadFiles[0].raw);
      this.$http
        .post("/dictionary/dictmajorfj/upload", formData, {
          params: {
            fjId: _this.RoomID,
            title: _this.FJimgUploadFrom.title,
          },
        })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          this.$message.success("上传成功！");
          _this.FJdialogVisible = false;
          _this.BtnLoading = false;
          _this.GetroomImg();
        })
        .catch(() => {});
    },
    deptIdChange1(val) {
      let a = "";
      if (this.$refs.myCascader.getCheckedNodes()[0]) {
        a = this.$refs.myCascader.getCheckedNodes()[0].value;
        this.getUserList(a);
      }
    },
    // 获取部门员工列表
    getUserList1(deptId) {
      let _this = this;
      this.$http
        .get(`/sys/user/deptUserList`, {
          params: {
            deptId: deptId,
          },
        })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          _this.maintainList = res.data;
        })
        .catch(() => {});
    },
    //维护人添加
    maintainChange(item) {
      let _this = this;
      let obj = {
        numId: _this.LDid,
        maintain: item.id,
        deptId: item.deptId,
      };
      if (obj.maintain) {
        this.$http
          .post(`/dictionary/dictmajorzd/savemaintain`, obj)
          .then(({ data: res }) => {
            if (res.code !== 0) {
              return this.$message.error(res.msg);
            }
            _this.$message.success("添加成功");
            _this.getMaintain(_this.LDid); //获取维护人列表
            _this.AddMaintainCheck = {
              id: "",
              deptId: "",
              maintainName: "",
            };
          })
          .catch(() => {});
      } else {
        this.$message.error("请选择要添加的维护人！");
      }
    },
  },
  activated() {},
  watch: {
    $route(to, from) {
      // this.MaintainType = JSON.parse(
      //     sessionStorage.getItem("MaintainType")
      // );
      if (to.name == "BuildingDictionaries") {
        this.floorID = this.$route.query.ID;
        this.floorName = this.$route.query.name;
        this.ZDsaveFrom.dictId = this.$route.query.ID;
        this.DYsaveFrom.dictId = this.$route.query.ID;
        this.LCsaveFrom.dictId = this.$route.query.ID;
        this.FJsaveFrom.dictId = this.$route.query.ID;
        this.getDictmajorzdList();
      }
    },
  },
};
</script>
<style scoped lang="scss">
.title {
  font-size: 18px;
  font-weight: 600;
}
ul,
li {
  /* margin: 0; */
  padding: 0;
  list-style: none;
}
.Dictionaries_LD_img {
  display: inline-block;
  width: 70px;
  height: 70px;
  float: left;
  cursor: pointer;
}
.Dictionaries_LD_img img {
  width: 100%;
}
.Dictionaries_LD_d {
  float: left;
}
.Dictionaries_LD_d_t {
  margin: 6px;
}
.Dictionaries_LD_d_b {
  margin: 6px;
}
.Dictionaries_t_ul {
  margin: 5px 0px;
}

.BuildingDictionaries_radio {
  float: left;
  margin-right: 10px;
}

.Arrow {
  display: inline-block;
  width: 0px;
  height: 0;
  border: 10px solid rgba(255, 255, 255, 0);
  border-bottom: 10px solid white;
  position: relative;
  top: 4px;
}
s .colorBoxMain {
  padding: 5px 6px;
}
.colorBox {
  display: inline-block;
  width: 24px;
  height: 14px;
  border-radius: 2px;
}
.roomTable {
  margin-top: 10px;
}
.roombox {
  max-height: 49px;
  float: left;
  margin-right: 20px;
  text-align: center;
  margin-top: 5px;
  border: 1px solid rgba(212, 212, 212, 0);
  padding-bottom: 3px;
}
.roombox:hover {
  border: 1px solid rgb(226, 226, 226);
}
.roombox_t {
  border-radius: 3px;
  text-align: center;
  cursor: pointer;
  padding: 0px 5px;
  white-space: nowrap;
}
.election_man {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgb(61, 194, 255);
  margin-top: 5px;
  text-align: center;
}
.election_con {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(61, 194, 255);
  margin: 3px auto;
}
.election_con2 {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 10px;
}

.Rrght_tabs_ul {
  width: 100%;
  margin: 0px;
  li {
    line-height: 35px;
    color: #737373;
    span {
      display: inline-block;
      width: 125px;
      text-align: right;
      padding-right: 10px;
    }
  }
}

.roomImg_main {
  width: 100%;
  ul {
    width: 100%;
    max-height: 500px;
    overflow: auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    li {
      width: 170px;

      margin-bottom: 15px;
      div {
        width: 100%;
        height: 115px;
        border-radius: 10px;
        overflow: hidden;
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
}
.genjing_btn {
  width: 51%;
  margin: 15px 0px !important;
}
.svgIconStyle {
  display: inline-block;
  width: 16px;
  height: 18px;
  margin: 0px 5px;
  vertical-align: top;
}
.svgIconStyle2 {
  display: inline-block;
  margin: 0px 8px;
  padding-top: 3px;
  vertical-align: top;
}
</style>